package com.todo.biz.application.helper.detection;

import com.aliyun.green20220302.Client;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author azhebuxing
 * @date 2024/12/2 20:20
 * @description
 */
@Data
@Component
@ConfigurationProperties(prefix = "aliyun.oss")
public class AliyunDetectionConfig {

    private String endpoint;

    private String accessKeyId;

    private String accessKeySecret;


    @Bean
    public Client initDetectionClient() throws Exception {
        com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
        .setAccessKeyId(accessKeyId)
        .setAccessKeySecret(accessKeySecret)
        .setEndpoint(endpoint);
        return new Client(config);
    }
}
